<?php
/**
 * 请求示例
 *
 * Author: Zeon
 * Date: 2017/11/24
 * Created by Panxsoft.
 */
namespace App\Http\Requests;

use App\Exceptions\ApiErrCode;
use App\Http\Requests\ApiRequest;
use App\Models\OpenWechat\Authorizer;
use App\Validators\ExampleValidator;

/**
 * Class QrCodeRequest
 *
 * @property string|int scene_value - 二维码 event_key
 * @property int|null expire_seconds - 二维码过期时间
 * @property string forever - 如果有值则生成永久二维码
 *
 * @package App\Http\Requests\OpenWechat\Authorizer
 */
class ExampleRequest extends ApiRequest
{
    protected $auth_error_code = ApiErrCode::AUTHORIZE_ERROR_ID_APPID;

    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            /**
             * @see ExampleValidator::customizeRule()
             */
            'example' => 'required|example_rule:12312',
        ];
    }

    /**
     * @return array
     */
//    public function messages()
//    {
//        return [
//            'example.required'     => '示例参数必须',
//            /** :attribute 会被替换成下面 attributes 函数返回的数组中对应的key值替换 */
//            'example_rule'         => ':attribute自定义规则错误',
//            'example.example_rule' => ':attribute，更细节的描述自定义规则错误',
//        ];
//    }
//
//    /**
//     * Get custom attributes for validator errors.
//     *
//     * @return array
//     */
//    public function attributes()
//    {
//        return [
//            'example' => '示例名称'
//        ];
//    }
}
